﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
#endregion

namespace NJamb.DemoCode.Bowling
{
	public class Frame
	{
		public Frame()
		{
			IsStrike = false;
			Rolls = 0;
		}

		public bool IsStrike { get; private set; }
		public bool IsSpare { get; private set; }
		public int PinsUp { get; private set; }
		public int Rolls { get; private set; }

		public void Roll(IRoll roll)
		{
			Rolls += 1;
			if (roll is PerfectRoll)
			{
				PinsUp = 0;
			}
			IsStrike = PinsUp == 0 && Rolls == 1;
			IsSpare = PinsUp == 0 && Rolls == 2;
		}
	}

	public class PerfectRoll : IRoll {}

	public interface IRoll {}
}
